//
//  OosList.m
//  Oos4ios
//
//  Created by Pablo Gonzalez on 3/24/11.
//  Copyright 2011 11870.com. All rights reserved.
//

#import <oos4ios/Model/OosList.h>

@implementation OosList

@dynamic label;
@dynamic term;

@dynamic users;
@dynamic reviews;

static NSString *fetchPredicate = @"term = %@";

+ (OosList *) listFromTerm:(NSString *)term
{
    
    OosList *result = [super objectWithPredicate: fetchPredicate, term];
    
    if (!result) {
        result = [super create];
        result.term = term;
    }
    
    return result;
    
//	NSSet *objects = [super objectsWithPredicate: @"term = %@", term];
//	if ([objects count] > 0) {
//		return [objects anyObject];
//	} else {
//		OosList *list = [super create];
//		list.term = term;
//		return list;
//	}
}

- (NSString *) description
{
    return self.term;
}


@end
